package com.rmondjone.face.adapter

import android.graphics.Color
import android.util.Log
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.rmondjone.androidcamerademo.R
import com.rmondjone.androidcamerademo.bean.ListBean

/**
 * copyright：
 * @author：anthui creation date： .
 * @since: 1.0.0
 * @describe:List<ApdataBean>
 */
class ItemCheckAdapter(list: List<ListBean>) : BaseQuickAdapter<ListBean, BaseViewHolder>(R.layout.item_list_face2, list) {


    var checkPosition = 0
    override fun convert(helper: BaseViewHolder, item: ListBean) {
        helper.setText(R.id.tv_content, item.name)

        Log.e("msg", "checkPosition------ $checkPosition")
        var view = helper.getView<TextView>(R.id.tv_content)
        if (checkPosition == helper.adapterPosition) {
            view.setBackgroundResource(R.drawable.select_face_select)
            view.setTextColor(Color.parseColor("#ffffff"))
        } else {
            view.setTextColor(Color.parseColor("#BE9B6D"))
            view.setBackgroundResource(R.drawable.select_face)

        }
        helper.getView<TextView>(R.id.tv_content).isSelected = checkPosition == helper.adapterPosition
    }

}